package com.int_tech.control.controller;

/**
 * Created by liubochao on 2018/7/20.
 */
public class TestCircle {

    public static void main(String[] arg){

        getPoint();

    }



    public static String getPoint() {
        try {
            String sCurrentLine;
            String sTotalString;
            sCurrentLine = "";
            sTotalString = "";
            java.io.InputStream l_urlStream;

            java.net.URL l_url = new java.net.URL("http://api.map.baidu.com/geocoder/v2/?address=" + "陕西西安市高陵区耿镇镇东盈物流园5号库" + "&output=json&ak=TsCP2qXsP0RLmchQ7cQYyQa1C5Cwh4er&callback=showLocation");
            java.net.HttpURLConnection l_connection = (java.net.HttpURLConnection) l_url.openConnection();
            l_connection.connect();
            l_urlStream = l_connection.getInputStream();
            java.io.BufferedReader l_reader = new java.io.BufferedReader(new java.io.InputStreamReader(l_urlStream));
            String str = l_reader.readLine();
            //用经度分割返回的网页代码
            String s = "," + "\"" + "lat" + "\"" + ":";
            String strs[] = str.split(s, 2);
            String s1 = "\"" + "lng" + "\"" + ":";
            String a[] = strs[0].split(s1, 2);
//            System.out.println(a[1]);
            System.out.print(Float.parseFloat(a[1]));
            s1 = "}" + "," + "\"";
            String a1[] = strs[1].split(s1, 2);
//            System.out.println(a1[0]);
            System.out.print(Float.parseFloat(a1[0]));
            return null;
            //shop.setLat(a1[0]);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
